#pragma once
#include "Agent.h"
namespace org
{
	
	namespace spark
	{

		namespace core
		{
			//using org::spark::core::Agent;

			class Agent;
			/// <summary>
			/// A generic link agent.
			/// Any link agent has knowledge about two other agents
			/// which are connected by the link
			/// @author Monad
			/// 
			/// </summary>
			class Link : public Agent
			{
				/// <summary>
				/// SerialVersionUID
				/// </summary>
			private:
				//static const long long serialVersionUID = 4842070711491006805LL;

				/* Link's ends */
			protected:
				Agent *end1, *end2;

				/// <summary>
				/// The default constructor 
				/// 
				/// </summary>
			public:
				Link();


				/// <summary>
				/// A constructor </summary>
				/// <param name="end1"> </param>
				/// <param name="end2"> </param>
				Link(Agent *end1, Agent *end2);


				/// <summary>
				/// Removes one end of a link </summary>
				/// <param name="end"> </param>
				virtual void removeEnd(Agent *end);


				/// <summary>
				/// Returns the first link's end
				/// @return
				/// </summary>
				virtual Agent *getEnd1();


				/// <summary>
				/// Returns the second link's end
				/// @return
				/// </summary>
				virtual Agent *getEnd2();


				/// <summary>
				/// Connects specified agents by the link </summary>
				/// <param name="end1"> </param>
				/// <param name="end2"> </param>
				virtual void connect(Agent *end1, Agent *end2);


				/// <summary>
				/// Returns true if the link is connected to the given agent </summary>
				/// <param name="end">
				/// @return </param>
				virtual bool isConnectedTo(Agent *end);


				virtual void die();
			};

		}
	}
}